package com.tengju.user.domain.model.sign;


import com.tengju.user.domain.model.user.UserIdCode;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.time.LocalDateTime;

@Getter
@AllArgsConstructor
public class StarContractInfo {

    private UserIdCode idCode;

    private Integer contractType;

    private String contractId;

    private Integer contractStatus;

    private LocalDateTime contractSignDate;

    private LocalDateTime contractExpireDate;

    public void invalid() {
        this.contractStatus = StarContractStatus.INVALID.getStatus();
    }

    /**
     * 是否可以重新签约
     */
    public boolean isRenewContract(Integer renewForwardMonth) {
        LocalDateTime firstRenewDate = contractExpireDate.minusMonths(renewForwardMonth);
        return firstRenewDate.isBefore(LocalDateTime.now());
    }
}
